import './assets/main.css'
import 'element-plus/dist/index.css'
import 'vform3-builds/dist/designer.style.css'  //引入VForm3样式
import ElementPlus from 'element-plus'
import VForm3 from 'vform3-builds'  //引入VForm3库
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import service, { get, post, put, del, uploadFile, downloadFile } from '../config/server.js'
import { ElMessage, ElMessageBox } from 'element-plus'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router)
app.use(ElementPlus)
app.use(VForm3)

// 全局挂载API方法
app.config.globalProperties.$http = service
app.config.globalProperties.$get = get
app.config.globalProperties.$post = post
app.config.globalProperties.$put = put
app.config.globalProperties.$del = del
app.config.globalProperties.$uploadFile = uploadFile
app.config.globalProperties.$downloadFile = downloadFile
// 全局挂载消息提示
app.config.globalProperties.$message = ElMessage
app.config.globalProperties.$msgbox = ElMessageBox
app.config.globalProperties.$router = router

app.use(store)

app.mount('#app')
